<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/geetest','Admin\AuthController@getGeetest'); // 获取滑动验证码
Route::post('/login','Admin\AuthController@login')->name('login');  // 登录接口


Route::middleware(['auth.admin'])->group(function(){
    // 无需进行接口权限检查
   
    Route::group(['prefix' => 'user', 'namespace' => 'Admin'], function(){
        Route::get('/info','AuthController@userInfo');
        Route::get('/menu','AuthController@getUserMenu');
        Route::post('/logout','AuthController@logout');
    });

    Route::post('/upload','ImageController@upload');

});

Route::group(['namespace' => 'Admin'], function() {
    Route::get('/code/createProcess','CodeRecordController@createProcess');// 自定义微信菜单
    Route::middleware(['auth.admin', 'permission'])->group(function(){

        Route::group(['prefix' => 'user'], function(){
            Route::get('/list','AuthController@getList');
            Route::get('/store','RoleController@getStore');
            Route::get('/role_all','RoleController@getRoles');
            Route::post('/handle','AuthController@handle');
            Route::post('/delete','AuthController@delete');
        });

        Route::group(['prefix' => 'menu'], function(){
            Route::get('/list','MenuController@getList');
            Route::post('/handle','MenuController@handle');
            Route::get('/first','MenuController@getFirstMenu');
            Route::get('/second','MenuController@getSecondMenu');
            Route::post('/delete','MenuController@delete');
        });

        Route::group(['prefix' => 'rule'], function(){
            Route::get('/list','RuleController@getList');
            Route::post('/handle','RuleController@handle');
            Route::post('/delete','RuleController@delete');
        });

        Route::group(['prefix' => 'role'], function(){
            Route::get('/list','RoleController@getList');
            Route::post('/handle','RoleController@handle');
            Route::get('/menu/node','RoleController@getMenuNode');
            Route::get('/store','RoleController@getStore');
            Route::post('/delete','RoleController@delete');
        });

        Route::group(['prefix' => 'store'], function(){
            Route::get('/list','StoreController@storeList');
            Route::post('/handle','StoreController@storeSubmit');
            Route::post('/store_status','StoreController@storeStatus');
            Route::get('/store_info','StoreController@storeInfo');
        });

        Route::group(['prefix' => 'grade'], function(){
            Route::get('/ini','GradeController@iniGrade');
            Route::post('/handle','GradeController@gradeSubmit');
        });

        Route::group(['prefix' => 'share'], function(){
            Route::get('/ini','ShareController@iniShare');
            Route::get('/inputRadio','ShareController@inputRadio');
            Route::post('/handle','ShareController@shareSubmit');
        });

        Route::group(['prefix' => 'award'], function(){
            Route::get('/ini','TeamAwardController@iniAward');
            Route::post('/handle','TeamAwardController@awardSubmit');
        });

        Route::group(['prefix' => 'good'], function(){
            Route::group(['prefix' => 'type'], function(){
                Route::get('/list','GoodTypeController@getList');
                Route::post('/handle','GoodTypeController@handle');
                Route::get('/store','GoodTypeController@getStore');
                Route::post('/delete','GoodTypeController@delete');
            });
            // 初始化编辑商品所需数据
            Route::get('/handle/init','GoodController@handleInit');
            Route::post('/handle','GoodController@handle');
            Route::get('/list','GoodController@getList');
            Route::get('/load','GoodController@loadData');
            Route::post('/delete','GoodController@delete');
        });

        Route::group(['prefix' => 'pay'], function(){
            Route::get('/ini','PayConfigController@iniPay');
            Route::post('/handle','PayConfigController@paySubmit');
        });

        Route::group(['prefix' => 'banner'], function(){
            Route::get('/list','BannerController@getList');
            Route::post('/handle','BannerController@handle');
            Route::post('/delete','BannerController@delete');
        });

        Route::group(['prefix' => 'notice'], function(){
            Route::get('/list','NoticeController@getList');
            Route::post('/handle','NoticeController@handle');
            Route::post('/delete','NoticeController@delete');
        });

        Route::group(['prefix' => 'code'], function(){
            Route::get('/list','CodeRecordController@getList');
        });

        Route::group(['prefix' => 'member'], function(){
            Route::get('/list','MemberController@getList');
            Route::post('/handle','MemberController@handle');
            Route::get('/tree','MemberController@getTree');

            Route::get('/jgz_list','MemberController@jgz_list'); // 军功章数据
            Route::post('/jgz_send','MemberController@jgz_send'); // 军功章发放

            Route::get('/team_month_list','MemberController@teamMonthList'); // 月度合伙人奖金数据
            Route::post('/team_month_send','MemberController@teamMonthSend'); // 月度合伙人奖金发放

            Route::get('/gold_sum','MemberController@goldSum'); // 店铺总金额
            Route::post('/deduct','MemberController@deduct'); // 扣减公司账号余额

            Route::any('/daily_amount','MemberController@dailyAmount'); // 每日金额

            Route::get('/transfer_list','MemberController@transferList'); // 剩余金额转入教育基金数据
            Route::post('/transfer','MemberController@transfer'); // 剩余金额转入教育基金

            Route::get('/flh_list','MemberController@flhList'); // 富力惠奖金数据
            Route::post('/flh_send','MemberController@flhSend'); // 富力惠奖金发放

            Route::get('/bdmem_list','MemberController@bdMemPoolList'); // 报单指数列表
            Route::post('/bdmem_send','MemberController@bdMemPoolSend'); // 报单指数发放

            Route::get('/bdorder_list','MemberController@bdOrderPoolList'); // 分虹列表
            Route::post('/bdorder_send','MemberController@bdOrderPoolSend'); // 分虹发放

            Route::post('/getimporturl','MemberController@getImportUrl'); // 获取用户数据上传地址
            Route::post('/userimport','MemberController@userImport'); // 用户导入
            Route::get('/usertemplate_export','MemberController@userTemplateExport'); // 下载excel用户导入模版
        });

        Route::group(['prefix' => 'deal'], function(){
            Route::get('/admin/list','DealController@getList'); // 交易记录

            Route::get('/review_amount','DealController@reviewAmount');//系统金额审核
        });

        Route::group(['prefix' => 'order'], function(){
            Route::get('/admin/list','OrderController@getList');
            Route::post('/handle','OrderController@handle'); // 发货

            Route::get('/admin/get_send_list','OrderController@getSendList');//待发货列表

            Route::get('/review_order_list','OrderController@reviewOrderList');//订单审核列表数据
            Route::post('/review_order','OrderController@reviewOrder');//订单审核

            Route::get('/review_order_gold','OrderController@reviewOrderGold');//订单金额审核

        });

        Route::group(['prefix' => 'withdraw'], function(){
            Route::get('/list','WithdrawController@getList'); //获取提现列表数据
            Route::post('/agree','WithdrawController@agree'); //同意提现
            Route::post('/refuse','WithdrawController@refuse'); //拒绝提现
        });

        Route::group(['prefix' => 'mean'], function(){
            Route::get('/list','MeanController@getList');
            Route::post('/handle','MeanController@handle');
            Route::post('/delete','MeanController@delete');
        });
    });
});
